﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using DataTools.Interop.Hardware;


namespace TestApp
{
    public partial class Form1 : Form
    {
        private DiskInfo[] disks;

        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            disks = DiskUtil.EnumDisks();

            foreach (DiskInfo d in disks)
            {
                comboBox1.Items.Add(d);
            }

            comboBox1.SelectedIndex = 0;

            //MemPtr ptr = new MemPtr(1000000000);
            //int i;
            //byte[] b = new byte[1000000000];

            //DateTime d1;
            //DateTime d2;

            //TimeSpan ts1;
            //MemPtr op = ptr;
            //d1 = DateTime.Now;

            //for (i=0;i<1000000000;i++) {
            //    b[i] = (byte)ptr;
            //    ptr+=1;
            //}

            //d2 = DateTime.Now;

            //ts1 = new TimeSpan(d2.Ticks - d1.Ticks);

            //op.Free();



        }

        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            propertyGrid1.SelectedObject = comboBox1.Items[comboBox1.SelectedIndex];
        }

        private void button1_Click(object sender, EventArgs e)
        {
            DiskInfo d = (DiskInfo)comboBox1.Items[comboBox1.SelectedIndex];

            if (d != null)
            {
                d.OpenDevicePropertiesDialog();
            }
        }
    }
}
